<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/**
 * Class ApiRequestBodyTable api接口请求body表
 */
class ApiRequestBodyTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('api_request_body', function (Blueprint $blueprint) {
            $blueprint->increments('param_id')->comment('参数id');
            $blueprint->unsignedInteger('api_id')->comment('接口id');
            $blueprint->string('param_type')->comment('参数类型[int,string,bool,file]');
            $blueprint->string('param_name')->comment('参数名称');
            $blueprint->string('part')->comment('数据提交位置(header,body)');
            $blueprint->string('default')->comment('参数默认值');
            $blueprint->string('remark')->comment('备注');
            $blueprint->unsignedTinyInteger('required')->comment('是否必填[0-选填,1-必填]')->default(1);
            $blueprint->softDeletes();
            $blueprint->timestamps();
            $blueprint->index(['api_id'], 'idx_api');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('api_request_body');
    }
}
